package com.scfire.content

import java.util.Date

import org.grails.databinding.BindingFormat

class Articlepc implements Comparable{
	
	
	//标签
	String tag
	//标题
	String title
	//描述
	String content
	//链接地址
	String url
	//文章描述
	String description
	//封面
	String img
	
	//创建时间
	@BindingFormat('yyyy-MM-dd HH:mm:ss')
	Date date
	
	//归属频道
	static belongsTo = [channelpc:Channelpc]

    static constraints = {
		tag nullable: true
		title nullable:true
		content nullable:true
		url nullable:true
		img nullable:true
		date nullable:true
		description nullable:true
		channelpc nullable:true
    }
	
	@Override
	public int compareTo(Object o) {
		try{
			-date.compareTo(o?.date)
		}catch(Exception e){
			return 1
		}
	}
}
